home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-21 / api92.zip / BASICAPI.ZIP / SEND.BAS < prev    next >
BASIC Source File  |  1991-12-24  |  2KB  |  90 lines

  1. DECLARE SUB ProgramBody ()
  2. '***************************************************************************
  3. '*
  4. '*  Name:               Send
  5. '*
  6. '*  Function:           Send Mailbox
  7. '*
  8. '***************************************************************************
  9.  
  10. ' $INCLUDE: 'dvapi.bi'
  11.  
  12. ' minimum API version required and actual API version
  13. CONST required = &H201
  14.  
  15. DIM version AS INTEGER
  16. ' Object handles
  17. DIM SHARED win&, kbd&, malhan&
  18.  
  19. ' Variables used when reading the menu keyboard
  20. DIM SHARED kbuf$, selfield%
  21.  
  22.  
  23. '***************************************************************************
  24. ' Main Module - check for DESQview present and enable required extensions
  25. '***************************************************************************
  26.  
  27. ' Initialize DESQview interface and get API version number
  28. version = ApiInit%
  29.  
  30. ' If DESQview is not running or version is too low, display a message
  31. IF version < required THEN
  32.     OPEN "CONS:" FOR OUTPUT AS 1
  33.     PRINT #1, USING "This program requires DESQview version #.##"; required \ 256 + (required MOD 256) / 100
  34.     CLOSE 1
  35. ELSE
  36. ' Tell DESQview what extensions to enable and start application
  37.     CALL ApiLevel(required)
  38.     CALL ProgramBody
  39. END IF
  40.  
  41. ' Disable DESQview interface and return from program
  42. CALL ApiExit
  43.  
  44. SUB ProgramBody
  45. '***************************************************************************
  46. ' ProgramBody - build menu and display message when item selected
  47. '***************************************************************************
  48.     Attempt! = 0
  49.     OPEN "Cons:" FOR OUTPUT AS #1
  50. '
  51. ' First, get our Mailbox Handle
  52. '
  53.     malhan& = MalMe&
  54. '
  55. ' Assign global name "Send"
  56. '
  57.     CALL MalName(malhan&, "Send")
  58. '
  59. ' Look for the Receive mailbox; loop until found
  60. '
  61. Find:   RecHan& = MalFind&("Receive")
  62.     IF RecHan& = 0 THEN
  63.         PRINT #1, "<SERVER NOT FOUND>";
  64.         GOTO Find
  65.     END IF
  66. '
  67. ' At this point, RecHan& is mailbox of receiver
  68. '
  69. Talk:   msg$ = STR$(Attempt)
  70.     PRINT #1, "<SEND>";
  71.     errstat% = MalWrite%(RecHan&, msg$)
  72.     IF errstat > 0 THEN
  73. ' Error handling would go here
  74.     END IF
  75. '
  76. ' Get the message from receive module
  77. '
  78.     Message$ = MalRead$(malhan&)
  79.     PRINT #1, "<RECEIVE RECEIPT -" + Message$ + ">"
  80.     Attempt = Attempt + 1
  81.     GOTO Talk
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. END SUB
  89.  
  90.